package com.webchat.client.payment.controller;


import com.webchat.client.payment.service.ArticleService;
import com.webchat.common.bean.APIResponseBean;
import com.webchat.common.bean.APIResponseBeanUtil;
import com.webchat.common.helper.SessionHelper;
import com.webchat.domain.vo.response.publicaccount.ArticleBaseResponseVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/client-service/chat/article")
public class ArticleController {


    @Autowired
    private ArticleService articleService;

    /**
     * 文章详情查询
     *
     * @param id
     * @return
     */
    @GetMapping("/detail/{id}")
    public APIResponseBean<ArticleBaseResponseVO> detail(@PathVariable Long id) {
        String userId = SessionHelper.getCurrentUserId();
        return APIResponseBeanUtil.success(articleService.detail(id, userId));
    }
}
